package com.etoak.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO<T> {

    public static final int SUCCES_CODE = 200;
    public static final int ERROR_CODE = 501;

    public static final String SUCCES_MSG = "success";
    public static final String ERROR_MSG = "error";

    private int code;

    private String msg;

    private T data;

    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<>(SUCCES_CODE, SUCCES_MSG, data);
    }

    public static <T> ResultVO<T> error(T data) {
        return new ResultVO<>(501, "error", data);
    }

}
